package com.techsoul.module.tms.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.techsoul.module.tms.pojo.entity.FreightVehicleDispatch;
import com.techsoul.module.tms.pojo.param.FreightVehicleDispatchSearchParam;

import com.techsoul.module.tms.pojo.vo.FreightVehicleDispatchVo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 配载单 Mapper 接口
 * </p>
 *
 * @author zhaowei
 * @since 2021-05-25
 */
public interface FreightVehicleDispatchMapper extends BaseMapper<FreightVehicleDispatch> {
    /**
     * 查询所有
     *
     * @param params params
     * @return List<FreightVehicleDispatchVo>
     */
    List<FreightVehicleDispatchVo> findAll(@Param("params") FreightVehicleDispatchSearchParam params);
     /**
     * 查询所有
     *
     * @param page page
     * @param params params
     * @return IPage<FreightVehicleDispatchVo>
     */
    IPage<FreightVehicleDispatchVo> findAll(Page<FreightVehicleDispatchVo> page,
        @Param("params") FreightVehicleDispatchSearchParam params);


    List<Map<String, Long>> getAddress();

    void updateLocation(@Param("id") Long id, @Param("s") BigDecimal s, @Param("s1") BigDecimal s1);


    BigDecimal selectSumVolume(@Param("dispatchId") String dispatchId);

    /**
     * 根据dispatchId查询总重量
     * @param dispatchId
     * @return
     */
    BigDecimal selectSumWeight(@Param("dispatchId") String dispatchId);

    BigDecimal selectSumAp(@Param("dispatchId") String dispatchId);

    BigDecimal selectSumAr(@Param("dispatchId") String dispatchId);

    FreightVehicleDispatchVo findById(@Param("id") String id);
}
